/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package managedBeans;

import facade.SuiLibFacade;
import facade.exception.NotExistingObjectException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.EJB;
import managedBeans.util.CourseToEdit;
import valueObject.CourseVO;

/**
 *
 * @author David
 */
public class editCourseMB {

    private int idCourse;
    private CourseVO course;
    
    @EJB
    SuiLibFacade suilibFacade;
    /**
     * @return the idCourse
     */
    public int getIdCourse() {
        return CourseToEdit.getInstance().getId();
    }

    /**
     * @param aIdCourse the idCourse to set
     */
    public void setIdCourse(int aIdCourse) {
        idCourse = aIdCourse;
    }
    /**
     * Creates a new instance of editCourseMB
     */
    public editCourseMB() {
    }

    /**
     * @return the name
     */
    public String name() {
        try {
            this.setCourse(suilibFacade.getCourseVOById(CourseToEdit.getInstance().getId()));
        } catch (NotExistingObjectException ex) {
            Logger.getLogger(editCourseMB.class.getName()).log(Level.SEVERE, null, ex);
        }
        return course.getName();
    }

    /**
     * @param name the name to set
     */
   

    /**
     * @return the course
     */
    public CourseVO getCourse() {
        return course;
    }

    /**
     * @param course the course to set
     */
    public void setCourse(CourseVO course) {
        this.course = course;
    }
    
    public String description() {
        return course.getDescription();
    }
}
